import handle
import pickle

class School(object):
    def __init__(self, name, addr):
        self.name = name
        self.addr = addr
        self.sstudents = []
        self.steachers = []
        self.sclass = []
        self.scourse = {}
        self.course = {'course_name': '', 'cycle': '', 'course_price': ''}

    # 开设课程
    def found_courses(self, course_name, course_cycle, course_price):
        self.course['course_name'] = course_name
        self.course['cycle'] = course_cycle
        self.course['course_price'] = course_price
        self.scourse[course_name] = self.course
        handle.savepickle(self.scourse, '%s课程.pkl' % (self.name))
        self.scourse = {}

    #雇佣老师
    def hire(self,tea_obj):
        self.steachers.append(tea_obj)
        savepickle(self.steachers,'ssteachers.pkl')


    #创建班级.通过学校创建班级， 班级关联课程、讲师
    def found_class(self,class_id):
        self.sclass.append(class_id)

#
#
# class People(object):
#     def __init__(self,name,age,sex):
#         self.name = name
#         self.age = age
#         self.sex = sex
#
#
# class Students(People):
#     def __init__(self,name,age,sex):
#         super(Students,self).__init__(name,age,sex)
#
#         print('''
#                --------student %s--------
#                name:%s
#                age:%s
#                sex:%s
#                ''' % (self.name, self.name, self.age, self.sex))
#     #注册.创建学员时，选择学校，关联班级
#     def enroll(self):
#
#     #选择班级
#     def choice_class(self):
#
#     #交学费
#     def pay_tuition(self):
#
#     #成绩.对应课程的字典{}
#     def grade(self):
#
#
#
# class Teachers(People):
#     #创建讲师角色时要关联学校
#     #上课时选择班级，查看学生列表
#
#     #修改成绩
#     def grade_alter(self):


a = School('newyork','chenggu')
print(a.name)
a.found_courses('english','4','4444')
a.found_courses('chinese','12','4444')
print(handle.lookfile('newyork课程.pkl'))